Improve Schema Error Details#9838
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves schema discovery error diagnostics by adding a developer-facing “type inference path” that explains how an unresolved type reference was reached during type discovery, and by exposing that path in a structured error extension.
Changes:
- Add
TypeInferencePathBuilderto build a root-to-leaf member chain for unresolved type references (short + namespace-qualified renderings, with truncation). - Enhance
TypeDiscoverer.CollectErrors()to append the short path to the error message and include the expanded path inerror.Extensions["typePath"]. - Add/adjust tests and snapshot baselines to validate path formatting, truncation, and the new extension.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/HotChocolate/Core/src/Types/Configuration/TypeDiscoverer.cs |
Formats unresolved-type errors deterministically and enriches them with a computed type inference path (message + extension). |
src/HotChocolate/Core/src/Types/Configuration/TypeInferencePathBuilder.cs |
New helper to locate and render member chains leading to a target TypeReference, including truncation and friendly type-name formatting. |
src/HotChocolate/Core/src/Types/TypeErrorFields.cs |
Adds the typePath extension key constant. |
src/HotChocolate/Core/test/Types.Tests/Configuration/TypeDiscovererTests.cs |
Adds tests for message path inclusion, typePath extension, friendly generic naming, and truncation behavior. |
src/HotChocolate/Core/test/Types.Tests/Configuration/__snapshots__/TypeDiscovererTests.DiscoverTypes_Should_Append_PathToRoot_When_Nested_Member_Cannot_Be_Inferred.snap |
New snapshot baseline for the enhanced error message format. |
src/HotChocolate/Core/test/Types.Tests/Configuration/__snapshots__/TypeDiscovererTests.Cannot_Infer_Input_Type.snap |
Updates snapshot baseline to reflect the new multi-line message with appended inference path. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Jun 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #9546